// 笔试强训day22：添加字符

#include <iostream>
using namespace std;

int main() {
    string A, B;
    cin >> A >> B;
    int a = A.size(), b = B.size(), dis = a;
    for(int i = 0; i < b - a + 1; i++)
    {
        int count = 0;
        for(int j = 0; j < a; j++)
        {
            if(A[j] != B[i + j])
                count++;
        }
        if(count < dis)
            dis = count;
    }
    cout << dis << endl;
    return 0;
}